Skip to content

[pull] main from openai:main - #140

Merged
pull[bot] merged 4 commits into
gitupdates:mainfrom
openai:main
Aug 21, 2026
Merged

[pull] main from openai:main#140
pull[bot] merged 4 commits into
gitupdates:mainfrom
openai:main

Conversation

@pull

@pull pull Bot commented Aug 21, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

- [x] I understand that this repository is auto-generated and my pull
request may not be merged

## Changes being requested

Move the handwritten webhook regression suite from the generated
resource-test
file to `tests/lib/test_webhooks.py`. The new file is byte-for-byte
identical to
the old file after removing its generated-file header. The generated
path
returns to the verified Castiron output.

All 71 collected cases remain. The existing synthetic signature
fixtures, time
mocks, secret/header validation, timestamp tolerance, byte payloads,
multiple
signatures, exceptions, and sync/async client modes are unchanged. No
webhook
verification code, public API, or generation metadata changes are
included.

## Additional context & links

Coverage now lives in these exact classes:

-
[`tests/lib/test_webhooks.py::TestWebhooks`](https://github.com/openai/openai-python/blob/c69d47ae202259ed693a8ae230e97ab988371bfd/tests/lib/test_webhooks.py#L32):
  16 methods, 31 collected cases.
-
[`tests/lib/test_webhooks.py::TestAsyncWebhooks`](https://github.com/openai/openai-python/blob/c69d47ae202259ed693a8ae230e97ab988371bfd/tests/lib/test_webhooks.py#L170):
  14 methods, 40 collected cases, including aiohttp.

<details>
<summary>Exact preserved test methods</summary>

Both classes retain:

- `test_unwrap_with_secret`
- `test_unwrap_without_secret`
- `test_unwrap_with_client_secret`
- `test_verify_signature_valid`
- `test_verify_signature_invalid_secret_format`
- `test_verify_signature_invalid`
- `test_verify_signature_missing_webhook_signature_header`
- `test_verify_signature_missing_webhook_timestamp_header`
- `test_verify_signature_missing_webhook_id_header`
- `test_verify_signature_payload_bytes`
- `test_verify_signature_timestamp_too_old`
- `test_verify_signature_timestamp_too_new`
- `test_verify_signature_multiple_signatures_one_valid`
- `test_verify_signature_multiple_signatures_all_invalid`

`TestWebhooks` also retains `test_verify_signature_custom_tolerance` and
`test_verify_signature_recent_timestamp_succeeds`.

</details>

Validation:

- Pytest collection matches all 71 original node IDs after replacing
only the
  module path, in both Pydantic modes.
- Command: `python -m pytest -q -n 4
tests/api_resources/test_webhooks.py tests/lib/test_webhooks.py`
  passed 71 tests under Pydantic v2 and 71 under Pydantic v1.
- `./scripts/format` and `./scripts/lint` passed, including Ruff,
Pyright, mypy,
  and import checks. Unrelated reporter formatting is excluded.
- The public custom-code report verifies 41 -> 40 mixed files, one
removed
customization, and no other changed customizations.
`.castiron.stats.yml`
  is unchanged.

For a byte-level check, both commands return
`09e457aee921b3c53c64485fc235724ea4ed5402`:

```sh
$ git show 8edd9ae:tests/api_resources/test_webhooks.py | tail -n +3 | git hash-object --stdin
$ git rev-parse c69d47a:tests/lib/test_webhooks.py
```
- [x] I understand that this repository is auto-generated and my pull
request may not be merged

## Changes being requested

Move the duplicated embeddings response decoder into the SDK-owned
`lib/_parsing/_embeddings.py` module. Both resource methods use the
existing
`post_parser` hook. The decoder logic is unchanged: omitted encoding
requests
base64 and decodes it in place; explicit formats pass through; empty
data keeps
the existing `ValueError`; NumPy and stdlib decoding keep their existing
errors.

Public signatures, exports, request fields and order, sync/async
behavior, and
raw/streaming response wrappers are unchanged. No compiler, schema,
dependency,
or generation-metadata changes are included.

## Additional context & links

New handwritten coverage is in `tests/lib/test_embeddings.py`:

- `test_decode_preserves_response_and_non_string_vectors` checks
in-place
decoding, both omitted-value sentinels, and untouched non-string
vectors.
- `test_explicit_format_is_untouched`,
  `test_missing_data_keeps_existing_error`, and
`test_invalid_data_preserves_decoder_errors` cover passthrough and
failures.
- `test_sync_create_uses_decoder` and `test_async_create_uses_decoder`
cover
normal, raw, and streaming responses with both decoder implementations.

Validation:

- Command: `python -m pytest -q -n 4
tests/api_resources/test_embeddings.py tests/lib/test_embeddings.py`
  passed 77 tests under Pydantic v2 and 77 under Pydantic v1.
- `./scripts/format` and `./scripts/lint` passed, including Ruff,
Pyright, mypy,
and import checks. Unrelated formatter-only reporter edits are excluded.
- `./scripts/build` passed; the wheel and source distribution both
contain the
  new private helper.
- The public custom-code report verifies 41 mixed files, only the
embeddings
customization changed, and 40 other customizations unchanged. The
embeddings
patch shrinks from +73/-22 to +27/-21. `.castiron.stats.yml` is
unchanged.

Command to reproduce the report from this branch:

```sh
$ python3 scripts/castiron/custom_code_report.py report \
    --base 8edd9ae \
    --head 38cf9c9 \
    --fetch --require-head-hash --public \
    --out /tmp/castiron-embedding-decoder
```
- [x] I understand that this repository is auto-generated and my pull
request may not be merged

## Changes being requested

Move the transcription and translation response-format selectors into
the
SDK-owned `lib/_parsing/_audio.py` module. Keep the existing private
resource
functions as thin wrappers, including their signatures and module
loggers.
The selection branches are unchanged, including `None`/omitted handling,
diarized transcription, text formats, and the existing fallback
warnings.

Every resource class is unchanged: public overloads, return annotations,
request fields and order, decorators, and sync/async response wrappers
stay
intact. No compiler, schema, dependency, or generation-metadata changes
are
included.

## Additional context & links

New handwritten coverage is in
`tests/lib/test_audio_response_format.py`:

- `test_supported_formats_keep_exact_response_classes` and
  `test_default_compatibility_values` check the exact response classes.
- `test_fallback_keeps_resource_logger_and_method` and
  `test_fallback_keeps_historical_logger_name_and_warning` preserve the
fallback class, logger, warning text, and existing `warn`/`warning`
behavior.
- `test_sync_create_uses_selected_response_class` and
`test_async_create_uses_selected_response_class` cover every supported
format
through normal, raw, and streaming responses in strict and loose modes.
- `test_sync_transcription_stream_still_yields_events` and
`test_async_transcription_stream_still_yields_events` retain
event-stream
  behavior. The existing overload checks remain in
`tests/lib/test_audio.py::test_translation_create_overloads_in_sync` and
`tests/lib/test_audio.py::test_transcription_create_overloads_in_sync`.

Validation:

- Command: `python -m pytest -n 0
tests/lib/test_audio_response_format.py tests/lib/test_audio.py
tests/api_resources/audio/test_transcriptions.py
tests/api_resources/audio/test_translations.py`
  passed 245 tests under Pydantic v2 and 245 under Pydantic v1.
- `./scripts/format` and `./scripts/lint` passed, including Ruff,
Pyright,
mypy, and import checks. Unrelated formatter-only reporter edits are
excluded.
- `./scripts/build` passed; the wheel and source distribution both
contain
  the new private helper.
- The public custom-code report verifies 41 mixed files, with only the
two
audio customizations changed and 39 others unchanged. Transcriptions
shrink
from +160/-53 to +145/-52; translations shrink from +155/-39 to
+143/-39.
  `.castiron.stats.yml` is unchanged.

Command to reproduce the report from this branch:

```sh
$ python3 scripts/castiron/custom_code_report.py report \
    --base 8edd9ae \
    --head 676b9e7 \
    --fetch --require-head-hash --public \
    --out /tmp/castiron-audio-format-selection
```
- [x] I understand that this repository is auto-generated and my pull
request may not be merged

## Changes being requested

Move the identical webhook header/timestamp/HMAC verification core into
the
SDK-owned `lib/_webhooks.py` module. The public sync and async wrappers
retain
their signatures, client-secret fallback, mismatch errors, and their
existing
exception-chaining differences. Both `unwrap` methods are unchanged.

The helper keeps the same replay-window checks, secret decoding, signed
bytes,
signature order, and `hmac.compare_digest` calls. This is a
behavior-preserving
extraction, not a change to accepted signatures or verification policy.
Generation metadata, dependencies, workflows, and the API reference are
unchanged.

The verified custom-code report keeps 40 mixed files and changes only
the
webhook resource's patch: **+179/-3 → +89/-3**. The other 39
customizations are
unchanged.

## Additional context & links

Please get SDK CODEOWNER review for this verification-boundary change.

The existing 71 cases remain unchanged in

[`tests/lib/test_webhooks.py::TestWebhooks`](https://github.com/openai/openai-python/blob/ece4324da0b96f848b48bdef090a372ff0a1db26/tests/lib/test_webhooks.py#L32)
and

[`tests/lib/test_webhooks.py::TestAsyncWebhooks`](https://github.com/openai/openai-python/blob/ece4324da0b96f848b48bdef090a372ff0a1db26/tests/lib/test_webhooks.py#L170).
The new

[`tests/lib/test_webhook_signature.py`](https://github.com/openai/openai-python/blob/35d955800683b814490c7a583b91611c30df9a71/tests/lib/test_webhook_signature.py)
adds 87 cases for raw/prefixed/empty secrets, text/bytes payloads,
replay-window
boundaries, exact timestamp text, header order, malformed inputs, and
constant-time comparison order. In particular,

[`test_missing_secret_preserves_wrapper_exception_chaining`](https://github.com/openai/openai-python/blob/35d955800683b814490c7a583b91611c30df9a71/tests/lib/test_webhook_signature.py#L146)
and

[`test_mismatch_preserves_wrapper_exception_chaining`](https://github.com/openai/openai-python/blob/35d955800683b814490c7a583b91611c30df9a71/tests/lib/test_webhook_signature.py#L161)
pin the existing sync/async differences.

Validation: exact-source/AST preservation check; `./scripts/format`;
`./scripts/lint` (Ruff, Pyright, mypy, import); wheel and sdist builds
with the
new helper included; **158 tests passed under Pydantic v2 and 158 under
v1**.
@pull pull Bot locked and limited conversation to collaborators Aug 21, 2026
@pull pull Bot added the ⤵️ pull label Aug 21, 2026
@pull
pull Bot merged commit e14ac34 into gitupdates:main Aug 21, 2026
10 of 11 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant